<!--
 * @Author: your name
 * @Date: 2021-10-07 09:59:27
 * @LastEditTime: 2021-10-08 18:41:07
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue3.0\vue3_vite\src\pages\connection\test1\father.vue
-->
<template>
  <div>
    <h1>father</h1>
    <p>{{ count }}</p>
    <a-button type="primary" @click="addCount">add</a-button>

    <Child :count="count" @chChangeCount="changeCount" />
  </div>
</template>

<script>
import { ref } from 'vue'
import Child from './child.vue'

export default {
  setup(props) {
    const count = ref(0)

    const addCount = () => {
      count.value ++
    }

    const changeCount = (val) => {
      console.log('val', val)
      count.value = val
    }

    return {
      count,
      addCount,
      changeCount,
    }
  },
  components: {
    Child
  }
}
</script>

<style>

</style>